<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
<html>
<head>
	<title>人员认证审批管理</title>
	<meta name="decorator" content="default"/>
	<script type="text/javascript">
		$(document).ready(function() {
			
		});
		
		 function view(id){
			top.$.jBox.open("iframe:${ctx}/resumemissiontheory/resumeMissionTheory/form?id="+id, "审核",400,200,{
					buttons:{"审核":"ok","关闭":true}, bottomText:"输入分数。",submit:function(v, h, f){
						var score = h.find("iframe")[0].contentWindow.getValue();
						if (v=="ok"){
							if(score == null){
								alert("分数不能为空")
								return false;
							}else if(score > 5){
								alert("分数不能大于5")
								return false;
							}else if(score<=5 && score != ''){
								audit(score,id);
								return true;
							}else{
								alert("分数输入不正确")
								return false;
							}
					    	
						} else if (v=="clear"){
							h.find("iframe")[0].contentWindow.clearAssign();
							return false;
		                }
					}, loaded:function(h){
						$(".jbox-content", top.document).css("overflow-y","hidden");
					}
				});
		}
		
		function page(n,s){
			$("#pageNo").val(n);
			$("#pageSize").val(s);
			$("#searchForm").submit();
        	return false;
        }
        
            //清除缓存
        function audit(score,id) {
            //服务预约列表信息
            url = "${ctx}/resumemissiontheory/resumeMissionTheory/update/"+id+"/score/"+score+"/flag/CLOSE"
            $.ajax({
                type: "get",
                url: url,
                dataType: 'json',
                // data: parameter,
                success: function (data, textStatus) {
                 	 window.location.reload();
                },
                complete: function (XMLHttpRequest, textStatus) {
        			window.location.reload();
                },
                error: function () {
                }
            });
        }
        ;

		
		
	</script>
</head>
<body>
	<ul class="nav nav-tabs">
		<li class="active"><a href="${ctx}/resumemissiontheory/resumeMissionTheory/">人员认证审批列表</a></li>
		<shiro:hasPermission name="resumemissiontheory:resumeMissionTheory:edit"><li><a href="${ctx}/resumemissiontheory/resumeMissionTheory/form">人员认证审批添加</a></li></shiro:hasPermission>
	</ul>
	<form:form id="searchForm" modelAttribute="resumeMissionTheory" action="${ctx}/resumemissiontheory/resumeMissionTheory/" method="post" class="breadcrumb form-search">
		<input id="pageNo" name="pageNo" type="hidden" value="${page.pageNo}"/>
		<input id="pageSize" name="pageSize" type="hidden" value="${page.pageSize}"/>
		<ul class="ul-form">
			<li><label>登录名：</label><form:input path="user.account" htmlEscape="false" maxlength="50" class="input-medium"/></li>
			<li><label>姓&nbsp;&nbsp;&nbsp;名：</label><form:input path="user.name" htmlEscape="false" maxlength="50" class="input-medium"/></li>
			<li class="btns"><input id="btnSubmit" class="btn btn-primary" type="submit" value="查询" onclick="return page();"/>
		</ul>
	</form:form>
	<sys:message content="${message}"/>
	<table id="contentTable" class="table table-striped table-bordered table-condensed">
		<thead>
			<tr>
				<th>用户名</th>
				<th>电话号码</th>
				<th>认证图片</th>
				<th>认证状态</th>
				<th>操作</th>
			</tr>
		</thead>
		<tbody>
		<c:forEach items="${page.list}" var="resumeMissionTheory">
			<tr>
				<td>
					${resumeMissionTheory.user.name}
				</td>
				<td>
					${resumeMissionTheory.user.phone}
				</td>
				<td>
					<a href="${resumeMissionTheory.img}" target=_blank>图片</>
				</td>
				<td>
					<c:choose>
                    <c:when test="${resumeMissionTheory.status== 'PENDING'}">
                    	等待审核
                     </c:when>
                     <c:when test="${resumeMissionTheory.status== 'CLOSE'}">
                    	审核通过
                     </c:when>
                     <c:when test="${resumeMissionTheory.status== 'REJECT'}">
                    	审核不通过
                     </c:when>
                     <c:otherwise>
                    </c:otherwise>
                	</c:choose>
				</td>
				<td>
					<a href="${ctx}/resumemissiontheory/resumeMissionTheory/delete?id=${resumeMissionTheory.id}" onclick="return confirmx('确认要删除该人员认证审批吗？', this.href)">删除</a>
					<c:choose>
                    <c:when test="${resumeMissionTheory.status== 'PENDING'}">
                    			<a href="#" onclick="view('${resumeMissionTheory.id}')">通过</a>
								<a href="${ctx}/resumemissiontheory/resumeMissionTheory/update/${resumeMissionTheory.id}/score/0/flag/REJECT" onclick="return confirmx('确认要审核不通过吗？', this.href)">失败</a>
                     </c:when>
                     <c:otherwise>
                    </c:otherwise>
                	</c:choose>
				</td>
			</tr>
		</c:forEach>
		</tbody>
	</table>
	<div class="pagination">${page}</div>
</body>
</html>